import sys

fin = open(sys.argv[1])
count = {}
for line in fin:
    line = line.strip()
    count[line] = count.get(line, 0) + 1

for key, value in sorted(count.viewitems(), reverse=True, key=lambda p: p[1]) :
    print "{}; {}".format(key, value)
    
